package com.xzw.text1;

import java.lang.reflect.Field;
import java.lang.reflect.Method;

public class AppCore {
    public static void main(String[] args) throws Exception {
        Class<?> C = Class.forName("com.xzw.text1.CustomerService");
        Object c = C.newInstance();

        Field service = C.getDeclaredField("service");
        service.setAccessible(true);
        Class<?> U = Class.forName("com.xzw.text1.UserService");
        service.set(c, U.newInstance());

        Method say = C.getMethod("say");
        say.invoke(c);
    }

}
